<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>月度产值统计</title>
  <style type="text/css">
  </style>
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card">
      <!-- 查询区域  -->
      <div id="query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
        	<div class="layui-inline">
            	<label class="layui-form-label">统计年份</label>
            	<div class="layui-input-inline">
              		<input type="text" class="layui-input" id="sts_year_id"  name="year" readonly>
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">公司主体</label>
            	<div class="layui-input-inline" style="width:260px;">
              		<select name="orgTypeAndId" id="query_select_orgId" lay-filter="query_select_orgId" lay-search >
	              		<c:if test="${not empty orgInfos }">
	              			<c:forEach items="${orgInfos}" var="org">
	              				<option value="${org.id}-${org.types}" <c:if test="${org.id == bindOrgId }">selected</c:if>>${org.compName }</option>
		            		</c:forEach>
	              		</c:if>
	              	</select>
            	</div>
          	</div>
          	<div class="layui-inline">
            	<label class="layui-form-label">项目名称</label>
            	<div class="layui-input-inline">
              		<input type="text" name="proName" id="query_input_proName"  placeholder="请输入" autocomplete="off" class="layui-input" >
            	</div>
          	</div>
          	<shiro:hasPermission name="LIST_OUTPUT_VALUE">
	          <div class="layui-inline">
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-outputValue-search">
	              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
	            </button>
	          </div>
          	</shiro:hasPermission>
        </div>
      </div>
      <div class="layui-card-body">
        <div style="text-align: center; margin-top:5px;  margin-bottom:18px;">
	          <div class="layui-inline" style="float:right;margin-bottom:2px;margin-right:0px;">
		         <label class="layui-form-label">单位：元</label> 
          	  </div>
        </div>
        <hr/>
        <table id="LAY-outputValue-manage" lay-filter="LAY-outputValue-manage"></table>
      </div>
    </div>
  </div>

  <script>
  	layui.config({
    	base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index' //主入口模块
  	}).use(['index', 'table', 'set', 'laydate', 'element'], function(){
    	var $ = layui.$
    	,form = layui.form
    	,table = layui.table
    	,laydate = layui.laydate
    	,element = layui.element;
	    
    	 laydate.render({
   	      elem: '#sts_year_id'
   	      ,type: 'year'
   	      ,btns: ['now', 'confirm']
   	      ,value: layui.util.toDateString(new Date(), 'yyyy') //当前年份
   	      ,done:function(value){
   	      	  table.reload('LAY-outputValue-manage', {page: {curr: 1},
   			 	 where: {'year':value,'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_proName').val()}
   		      });
   	      }
   	    });
    	 
		form.on('select(query_select_orgId)', function(data){
   		 	table.reload('LAY-outputValue-manage', {page: {curr: 1},
		 		where: {'year':$('#sts_year_id').val(),'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_proName').val()}
	      	});
    	});
		
    	// 表单
    	table.render({
      		elem: '#LAY-outputValue-manage'
      		,url: basePath + '/outputValue/queryDataByCondition' //请求数据接口
      		,where: {'year':$('#sts_year_id').val(),'orgTypeAndId':$('#query_select_orgId').val(),'proName':$('#query_input_proName').val()}
      		,cols: [[
				{type:'numbers', title: '序号',fixed:'left', width: 80, align:'center', rowspan:2}
				,{field: 'orgAreaName', title: '区域公司',fixed:'left',width: 180, align:'center', rowspan:2}
				,{field: 'proName', title: '项目名称',fixed:'left',width: 280, align:'center', rowspan:2}
				,{title: '1月份', colspan:3, align:'center'}
				,{title: '2月份', colspan:3, align:'center'}
				,{title: '3月份', colspan:3, align:'center'}
				,{title: '4月份', colspan:3, align:'center'}
				,{title: '5月份', colspan:3, align:'center'}
				,{title: '6月份', colspan:3, align:'center'}
				,{title: '7月份', colspan:3, align:'center'}
				,{title: '8月份', colspan:3, align:'center'}
				,{title: '9月份', colspan:3, align:'center'}
				,{title: '10月份', colspan:3, align:'center'}
				,{title: '11月份', colspan:3, align:'center'}
				,{title: '12月份', colspan:3, align:'center'}
				],[
				{field: 'outSureAmount1', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount1 != null && d.outSureAmount1 != ''){
							return formatCurrency(d.outSureAmount1);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount1', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount1 != null && d.inSureAmount1 != ''){
							return formatCurrency(d.inSureAmount1);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount1', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount1 != null && d.diffAmount1 != ''){
							return formatCurrency(d.diffAmount1);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount2', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount2 != null && d.outSureAmount2 != ''){
							return formatCurrency(d.outSureAmount2);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount2', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount2 != null && d.inSureAmount2 != ''){
							return formatCurrency(d.inSureAmount2);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount2', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount2 != null && d.diffAmount2 != ''){
							return formatCurrency(d.diffAmount2);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount3', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount3 != null && d.outSureAmount3 != ''){
							return formatCurrency(d.outSureAmount3);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount3', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount3 != null && d.inSureAmount3 != ''){
							return formatCurrency(d.inSureAmount3);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount3', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount3 != null && d.diffAmount3 != ''){
							return formatCurrency(d.diffAmount3);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount4', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount4 != null && d.outSureAmount4 != ''){
							return formatCurrency(d.outSureAmount4);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount4', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount4 != null && d.inSureAmount4 != ''){
							return formatCurrency(d.inSureAmount4);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount4', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount4 != null && d.diffAmount4 != ''){
							return formatCurrency(d.diffAmount4);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount5', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount5 != null && d.outSureAmount5 != ''){
							return formatCurrency(d.outSureAmount5);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount5', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount5 != null && d.inSureAmount5 != ''){
							return formatCurrency(d.inSureAmount5);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount5', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount5 != null && d.diffAmount5 != ''){
							return formatCurrency(d.diffAmount5);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount6', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount6 != null && d.outSureAmount6 != ''){
							return formatCurrency(d.outSureAmount6);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount6', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount6 != null && d.inSureAmount6 != ''){
							return formatCurrency(d.inSureAmount6);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount6', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount6 != null && d.diffAmount6 != ''){
							return formatCurrency(d.diffAmount6);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount7', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount7 != null && d.outSureAmount7 != ''){
							return formatCurrency(d.outSureAmount7);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount7', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount7 != null && d.inSureAmount7 != ''){
							return formatCurrency(d.inSureAmount7);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount7', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount7 != null && d.diffAmount7 != ''){
							return formatCurrency(d.diffAmount7);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount8', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount8 != null && d.outSureAmount8 != ''){
							return formatCurrency(d.outSureAmount8);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount8', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount8 != null && d.inSureAmount8 != ''){
							return formatCurrency(d.inSureAmount8);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount8', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount8 != null && d.diffAmount8 != ''){
							return formatCurrency(d.diffAmount8);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount9', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount9 != null && d.outSureAmount9 != ''){
							return formatCurrency(d.outSureAmount9);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount9', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount9 != null && d.inSureAmount9 != ''){
							return formatCurrency(d.inSureAmount9);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount9', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount9 != null && d.diffAmount9 != ''){
							return formatCurrency(d.diffAmount9);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount10', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount10 != null && d.outSureAmount10 != ''){
							return formatCurrency(d.outSureAmount10);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount10', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount10 != null && d.inSureAmount10 != ''){
							return formatCurrency(d.inSureAmount10);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount10', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount10 != null && d.diffAmount10 != ''){
							return formatCurrency(d.diffAmount10);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount11', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount11 != null && d.outSureAmount11 != ''){
							return formatCurrency(d.outSureAmount11);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount11', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount11 != null && d.inSureAmount11 != ''){
							return formatCurrency(d.inSureAmount11);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount11', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount11 != null && d.diffAmount11 != ''){
							return formatCurrency(d.diffAmount11);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'outSureAmount12', title: '对外',width: 150, align:'center', templet: function(d){
						if(d.outSureAmount12 != null && d.outSureAmount12 != ''){
							return formatCurrency(d.outSureAmount12);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'inSureAmount12', title: '对内',width: 150, align:'center', templet: function(d){
						if(d.inSureAmount12 != null && d.inSureAmount12 != ''){
							return formatCurrency(d.inSureAmount12);
						}else{
							return global_null_tip;
						}
					}
				}
				,{field: 'diffAmount12', title: '差额（对外-对内）',width: 150, align:'center', templet: function(d){
						if(d.diffAmount12 != null && d.diffAmount12 != ''){
							return formatCurrency(d.diffAmount12);
						}else{
							return global_null_tip;
						}
					}
				}
				]]
      		,page: true
      		,limit: 10
    	});
    
    	<shiro:hasPermission name="LIST_OUTPUT_VALUE">
	    	//监听搜索
	    	form.on('submit(LAY-outputValue-search)', function(data){
		      	//执行重载
		      	table.reload('LAY-outputValue-manage', {page: {curr: 1},
		        	where: trimData(data)
		      	});
	    	});
    	</shiro:hasPermission>
  });
  	
  </script>
</body>
</html>

